Skip to content

perf: defer charts.js/console.js; fix console leak after boost - #123

Merged
coderbuzz merged 1 commit into
mainfrom
perf/defer-scripts
Oct 16, 2026
Merged

coderbuzz merged 1 commit into
mainfrom
perf/defer-scripts

Conversation

@coderbuzz

Copy link
Copy Markdown
Owner
  • charts.js and console.js load with defer. Inline initLiveCharts(...) on app/server detail is wrapped in dockifyReady(fn) (app.js): waits for DOMContentLoaded on a full load, runs at once after an htmx swap.
  • Found while testing: the console cleanup was pushed to dockifyCleanups once at script load, so after the first boosted swap an open console's WebSocket stayed open when navigating away (main: 1 open console socket after leaving the page; this branch: 0). It is now registered when a console opens. setStatus ignores a status element that was swapped out (pageerror Cannot set properties of null on main when leaving with an open console).
  • DESIGN-SYSTEM §7.1 notes the dockifyReady rule.

Evidence (mock, port 18090, auth on):

  • ui.mjs PASS. DCL median (UI_RUNS=15, two alternating runs each) dashboard/servers/apps/app-detail: main 191/178/186/202 ms, branch 193/179/192/205 ms, i.e. unchanged within noise. Expected: deferred scripts still run before DCL, and htmx/app.js stay blocking, so defer only removes ~5 KB from the parser-blocking path.
  • /apps/{id} full load and boosted from /apps: 8 chart elements, live badge online, Console opens (xterm, Connected), no pageerror; after navigating away 0 open console sockets, cleanup list empty.
  • go build ./... && go vet ./... && go test ./... OK.

🤖 Generated with Claude Code

…ak after boosted navigation

Inline chart init waits for DCL on a full load (dockifyReady in app.js). The console cleanup is
registered when a console opens (it was pushed once at script load and lost after the first swap),
and setStatus ignores a status element that is gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderbuzz
coderbuzz merged commit c43f6be into main Oct 16, 2026
1 check passed
@coderbuzz
coderbuzz deleted the perf/defer-scripts branch October 16, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant